package org.xhy.bytebuddy;

import net.bytebuddy.implementation.bind.annotation.*;

import java.lang.reflect.Method;
import java.util.concurrent.Callable;

public class StaticMethodInterceptor {

    @RuntimeType
    public void constructEnhance(
            // 静态方法对应的类class对象
            @Origin Class<?> clazz,
            // 静态方法不可访问 @This Object targetObj,
            @Origin Method targetMethod,
            @AllArguments Object[] targetMethodArgs,
            // 静态方法不可访问 @Super Object targetSuperObj,
            @SuperCall Callable<?> zuper) throws Exception {
        System.out.println("before static method");
        zuper.call();
        System.out.println("after static method");
    }
}
